		
  function initpage(){
 
   	  var viewchar = "";
   	  for(var i=0;i<_ctype.length;i++)
   	  	{  
		   	  viewchar=_ctype.charAt(i);
		   	  switch (viewchar)
		   	  {
			   	  case"s":document.getElementById("id_shortTitle").style.display = "";break;
			   	  case"k":document.getElementById("id_keywords").style.display = "";break;	   	  
			   	  case"a":document.getElementById("id_author").style.display = "";break;	   	  
			   	  case"p":document.getElementById("id_smallPicUrl").style.display = "";break;	   	  
			   	  case"c":document.getElementById("id_smallContent").style.display = "";break;	   	  
			   	  case"m":document.getElementById("idcontent").style.display = "";break;	   	  
			   	  case"f":document.getElementById("id_uploadFile").style.display = "";break;	   	  
			   	  case"t":document.getElementById("id_availableDate").style.display = "";break;
			   	  case"l":document.getElementById("id_url").style.display = "";break; 
			   	  case"z":$("#viewtype1").attr("checked","checked");break;
			   	  case"b":$("#viewtype2").attr("checked","checked");break;
			   	  case"h":$("#viewtype3").attr("checked","checked");break;
			   	  case"d":$("#viewtype4").attr("checked","checked");break;
		   	  }
    	  } 
    	  if (viewtype.length>0){ $("#"+viewtype).attr("checked","checked");}
   	} 			
		
		
		
		
 function isEmpty(str){
			if(str==null || str.length==0){
			   return true;
			}else{
			   return false;
			}
		}	
		
function formSubmit(){
		    var _title = document.getElementById('_title').value;
		    if(isEmpty(_title)){
		           Ext.MessageBox.alert('提示框','</nobr>标题不得为空，请填写标题！</nobr>');
		           return;
		    }
		    if(_title.length>100){
  				   Ext.MessageBox.alert('提示框','</nobr>标题过长，请重写！</nobr>');
		       return;
		    }
		     
            var _author = document.getElementById('_author').value;
		    if(_author.length>100){
  				   Ext.MessageBox.alert('提示框','</nobr>作者过长，请重写！</nobr>');
		       return;
		    }
		    
		    var _shortTitle = document.getElementById('_shortTitle').value;
		    if(_shortTitle.length>100){
  				   Ext.MessageBox.alert('提示框','</nobr>短标题过长，请重写！</nobr>');
		       return;
		    }
   
		    var _smallContent = document.getElementById('_smallContent').value;
		    if(_smallContent.length>500){
  				   Ext.MessageBox.alert('提示框','</nobr>摘要过长，请重写！</nobr>');
		       return;
		    }
		    
		    var _keywords = document.getElementById('_keywords').value;
		    if(_keywords.length>50){
  				   Ext.MessageBox.alert('提示框','</nobr>关键字过长，请重写！</nobr>');
		       return;
		    }
		    
		    var _showOrder = document.getElementById('_showOrder').value;
		    if(_showOrder.length>20){
  				   Ext.MessageBox.alert('提示框','</nobr>显示顺序过长，请重写！</nobr>');
		       return;
		    }
		    		    
		    var _smallPicUrl = document.getElementById('_smallPicUrl').value;
		    if(_smallPicUrl.length>500){
  				   Ext.MessageBox.alert('提示框','</nobr>附件名称过长，请修改后重新上传。</nobr>');
		       return;
		    }
		    
		    var _uploadFile = document.getElementById('_uploadFile').value;
		    if(_uploadFile.length>500){
  				   Ext.MessageBox.alert('提示框','</nobr>附件名称过长，请修改后重新上传。</nobr>');
		       return;
		    }
//		    if(_ctype.indexOf("z")>0 & isEmpty(_uploadFile)){
//		           Ext.MessageBox.alert('提示框','</nobr>本栏目要求上传附件。</nobr>');
//		       return;
//		    }
		    		    
            if (_ctype.indexOf("t")>0){ 
            var _availableDate = document.getElementById('_availableDate').value;
            if(isEmpty(_availableDate)){
		           Ext.MessageBox.alert('提示框','</nobr>您未设置有效时间，请选取。</nobr>');
		           return;
		    }
            
            }
            document.getElementById('_isfile').value = $('input[@type=radio][@checked]').val();
            
//            if($("#viewtype0").attr("checked")){ document.getElementById('_isfile').value ='0'; }
//		    if($("#viewtype1").attr("checked")){ document.getElementById('_isfile').value ='1'; }
//            if($("#viewtype2").attr("checked")){ document.getElementById('_isfile').value ='2';} 
//            if($("#viewtype3").attr("checked")){ document.getElementById('_isfile').value ='3'; }   
//            if($("#viewtype4").attr("checked")){ document.getElementById('_isfile').value ='4'; }     
	   		document.form1.submit();
		}
   		
 

			    //限制只输入数字
			function number()
			{
			var char = String.fromCharCode(event.keyCode)
			var re = /[0-9]/g
			event.returnValue = char.match(re) != null ? true : false
			}
			
			function filterInput()
			{
			if (event.type.indexOf("key") != -1)
			{
			var re = /37|38|39|40/g
			if (event.keyCode.toString().match(re)) return false
			}
			event.srcElement.value = event.srcElement.value.replace(/[^0-9]/g, "")
			}
			
			function filterPaste()
			{
			var oTR = this.document.selection.createRange()
			var text = window.clipboardData.getData("text")
			oTR.text = text.replace(/[^0-9]/g, "")
			}		
		

		
		    function totop(){
	    	var   checktop   =   document.getElementsByName("checkboxtop");
	        if (checktop[0].checked){
	        	 document.getElementById('_showOrder').value = "置顶";
	      //  	 Ext.MessageBox.alert('提示框','置顶');
	        }else{
	            document.getElementById('_showOrder').value ="";
	        }
	    }	
			
	
		